package com.chainyoung.trademarket.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chainyoung.trademarket.R;
import com.chainyoung.trademarket.entity.FindItem;
import com.chainyoung.trademarket.widgets.BannerLoadInterface;

public class FindBannerLoader implements BannerLoadInterface {


    @Override
    public void displayData(Context context, Object data, ImageView iv, TextView title, TextView desc) {
        if (data instanceof FindItem){
            Glide.with(context)
                    .load(((FindItem) data).getBanner())
                    .apply(RequestOptions.errorOf(R.mipmap.ic_default))
                    .into(iv);
            title.setText(((FindItem) data).getName());
            desc.setText(((FindItem) data).getIntro());
        }
    }
}
